Part Number Hot Search : 
UVK1C222 C3101 167BZX SL9R1 BTS41 BUZ271 EM322809 LTC14
Product Description
Full Text Search
 

To Download AN4221 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  may 2014 docid024055 rev 2 1/51 AN4221 application note i2c protocol used in the stm32 bootloader introduction this application note describes the i2c prot ocol used in the stm32 microcontroller bootloader. it details each supported command. for more information about the i2c hardware resources and requirements for your device bootloader, please refer to application note an2606 ?stm32 microcontroller system memory boot mode?. . table 1. applicable products type part number or product series microcontrollers stm32f0 series: ? stm32f042xx, stm32f072xx stm32f3 series: ? stm32f318xx, stm32f328xx ? stm32f334xx ? stm32f358xx, stm32f378xx ? stm32f303x4(6/8) stm32f4 series: ? stm32f401xx, stm32f411xx ? stm32f405xx, stm32f407xx ? stm32f415xx, stm32f417xx ? stm32f429xx, stm32f439xx www.st.com
contents AN4221 2/51 docid024055 rev 2 contents 1 i2c bootloader code sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2 bootloader command set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.1 get command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.2 get version command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11 2.3 get id command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.4 read memory command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.5 go command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 2.6 write memory command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 2.7 erase memory command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 2.8 write protect command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 2.9 write unprotect command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 2.10 readout protect command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 2.11 readout unprotect command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 2.12 no-stretch write memory command . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 2.13 no-stretch erase memory command . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 2.14 no-stretch write protect command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 2.15 no-stretch write unprotect command . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 2.16 no-stretch readout protect command . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 2.17 no-stretch readout unprotect command . . . . . . . . . . . . . . . . . . . . . . . . . 46 3 bootloader protocol version evolution . . . . . . . . . . . . . . . . . . . . . . . . . 49 4 revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
docid024055 rev 2 3/51 AN4221 list of tables 3 list of tables table 1. applicable products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 table 2. i2c bootloader commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 table 3. bootloader protocol versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 table 4. document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
list of figures AN4221 4/51 docid024055 rev 2 list of figures figure 1. bootloader for stm32 with i2c. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 figure 2. get command: host side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 figure 3. get command: device si de . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 figure 4. get version: host side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 figure 5. get version: device side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 figure 6. get id command: host side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 figure 7. get id command: device side. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 figure 8. read memory command: host side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 figure 9. read memory command: device side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 figure 10. go command: host side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 figure 11. go command: device side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 figure 12. write memory command: host side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1 figure 13. write memory command: device side. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 figure 14. erase memory command: host side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 figure 15. erase memory command: device si de . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 figure 16. write protect command: host side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 figure 17. write protect command: device side. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 figure 18. write unprotect command: host side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 figure 19. write unprotect command: device side. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 0 figure 20. readout protect command: host side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1 figure 21. readout protect command: device side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 figure 22. readout unprotect command: host side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 figure 23. readout unprotect command: device side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 figure 24. no-stretch write memory command: host side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 figure 25. no-stretch write memory command: device side. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 figure 26. no-stretch erase memory command: host side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 figure 27. no-stretch erase memory command: device side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 figure 28. no-stretch write protect command: host side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 figure 29. no-stretch write protect command: device side. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 figure 30. no-stretch write unprotect command: host side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 figure 31. no-stretch write unprotect command: device side. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 figure 32. nostretch readout protect command: host side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 figure 33. no-stretch readout protect command: device side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 figure 34. no-stretch readout unprotect command: host side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 figure 35. no-stretch readout unprotect command: device side . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
docid024055 rev 2 5/51 AN4221 i2c bootloader code sequence 50 1 i2c bootloader code sequence figure 1. bootloader for stm32 with i2c note: the i2c slave address for each product's bootloader is specified in the an2606. once the system memory boot mode has been entered, and the stm32 microcontroller has been configured (for more details, refer to your stm32 system memory boot mode application note), the bootloader code begins to scan the i2c_sda line pin, waiting to detect its own address on the bus. once detected, the i2c bootloader firmware begins receiving host commands. 06y9 $gguhvvghwhfwhg 6odyhdgguhvv :dlwirud frppdqg *hwfpg urxwlqh *hwfpg 5'fpg urxwlqh *2fpg urxwlqh -3wrbdgguhvv &rppdqg uhfhlyhg *rfpg :5fpg urxwlqh
bootloader command set AN4221 6/51 docid024055 rev 2 2 bootloader command set "no stretch" commands are supported starting from v1.1 protocol version and allow a better management of commands when the host has to wa it a significant time before operation is accomplished by bootloader. it is highly recommended to use the "no stre tch" commands whenever possible instead of equivalent regular commands. the supported commands are listed in table 2 . table 2. i2c bootloader commands commands (1) command code command description get (2) 0x00 gets the version and the allowed commands supported by the current version of the bootloader get version (2) 0x01 gets the bootloader version get id (2) 0x02 gets the chip id read memory (2) 0x11 reads up to 256 bytes of memory, starting from an address specified by the application go (3) 0x21 jumps to user application code located in the internal flash memory write memory (3) 0x31 writes up to 256 bytes to the memory, starting from an address specified by the application no-stretch write memory (3)(4) 0x32 writes up to 256 bytes to the memory, starting from an address specified by the application and returns busy state while operation is ongoing erase 0x44 erases from one to all flash memory pages or sectors using two-byte addressing mode no-stretch erase (3)(4) 0x45 erases from one to all flash memory pages or sectors using two-byte addressing mode and returns busy state while operation is ongoing write protect 0x63 enables write protection for some sectors no-stretch write protect (4) 0x64 enables write protection for some sectors and returns busy state while operation is ongoing write unprotect 0x73 disables write prot ection for all flash memory sectors no-stretch write unprotect (4) 0x74 disables write protection for all flash memory sectors and returns busy state while operation is ongoing readout protect 0x82 enables read protection no-stretch readout protect (4) 0x83 enables read protection and returns busy state while operation is ongoing readout unprotect (2) 0x92 disables read protection no-stretch readout unprotect (2)(4) 0x93 disables read protection and returns busy state while operation is ongoing 1. if a denied command is received, or if an error occurs duri ng the command execution, the bo otloader sends a nack byte and goes back to command checking.
docid024055 rev 2 7/51 AN4221 bootloader command set 50 no-stretch commands no-stretch commands allows ex ecuting write, erase, write protect, write unprotect, read protect and read unprotect operations withou t stretching i2c line while bootloader is performing the operation. these commands a llows communicating with other devices on the bus while bootloader performs operation that require waiting time. the difference between these commands and the standard commands is at the end of the command: when hosts requests ack/nack at the end of the command, instead of stretching the i2c line, the bootloader respo nds with a third state which is busy (0x76). when host receives busy stat e, it should poll again on the state and read o ne byte till it receives ack or nack response. communication safety all communication from the programming host to the device is ve rified by checksum. received blocks of data byte s are xored. a byte containing the computed xor of all previous bytes is added to the end of each communication (checksum byte). by xoring all received bytes, data + checksum, the result at the end of the packet must be 0x00. for each command, the host sends a byte and its complement (xor = 0x00). each packet is either accepted (ack answer) or discarded (nack answer): ? ack = 0x79 ? nack = 0x1f with no-stretch commands busy state is sent instead of ack or nack when an operation is ongoing: ? busy= 0x76 note: the host's frame can be one of the following: ? send command frame: the host initiates communication as master transmitter, and sends two bytes to the device: command code + xor. ? wait for ack/nack frame: the host init iates an i2c communication as master receiver, and receives one byte from the device: ack or nack or busy. ? receive data frame: the host initiates an i2c communication as master receiver, and receives the response from the device. the number of received bytes depends on the command. ? send data frame: the host initiates an i2 c communication as master transmitter, and sends the needed bytes to the device. the number of transmitted bytes depends on the command. caution: for i2c communication, a timeout mechanism is implemented which must be respected for bootloader commands to be executed correct ly. this timeout is implemented between two i2c frames in the same command. for example, for a write memory command, a timeout is inserted between the command-sending frame and address memory-sending frame. also, the same timeout period is inserted between two successive instances of data reception or 2. read protection - when the rdp (read protec tion) option is active, only this limited subset of commands is available. all other commands are nacked and have no effect on the devic e. once the rdp has been removed, the other commands become active. 3. please refer to stm32 product datasheet and an2606: stm32 mi crocontroller system memory boot mode to know which memory spaces are valid for these commands. 4. no-stretch commands are availabl e only with i2c protocol v1.1.
bootloader command set AN4221 8/51 docid024055 rev 2 transmission in the same i2c frame. if the timeout period has elapsed, a system reset is generated to avoid a bootloader crash. plea se refer to an2606, section ?i2c bootloader timing characteristics? to get the i2 c timeout value of each stm32 product. 2.1 get command the get command allows you to get the version of the bootloader and the supported commands. when the bootloader receives t he get command, it transmits the bootloader version and the supported command codes to the host, as described in figure 2 . figure 2. get command: host side 06y9 6hqg&rppdqgiudph [[)) :dlwiru$&. ru1$&.iudph (qgri*hw 5hfhlyhgdwdiudph qxpehurie\whv errwordghuyhuvlrq olvwrivxssruwhgfrppdqgv 1$&. $&. 6wduw*hw :dlwiru$&. ru1$&.iudph 1$&. $&.
docid024055 rev 2 9/51 AN4221 bootloader command set 50 figure 3. get command: device side 06y9 5hfhlyhgiudph  [[))" 6hqg$&.iudph 6hqggdwdiudph qxpehurie\whvwrehvhqw errwordghuyhuvlrq olvwrivxssruwhgfrppdqgv 1r <hv 6wduw*hw (qgri*hw 6hqg1$&.iudph 6hqg$&.iudph
bootloader command set AN4221 10/51 docid024055 rev 2 the stm32 sends the bytes as follows: ? for i2c protocol v1.0: ? byte 1: ack ? byte 2: n = 11 = the number of bytes to follow - 1 except current and acks. ? byte 3: bootloader version 0x10 = version 1.0 ? byte 4: 0x00 - get command ? byte 5: 0x01 - get version ? byte 6: 0x02 - get id ? byte 7: 0x11 - read memory command ? byte 8: 0x21 - go command ? byte 9: 0x31 - write memory command ? byte 10: 0x44 - erase command ? byte 11: 0x63 - write protect command ? byte 12: 0x73 - write unprotect command ? byte 13: 0x82 - readout protect command ? byte 14: 0x92 - readout unprotect command ? byte 15: ack ? for i2c protocol v1.1: ? byte 1: ack ? byte 2: n = 17 = the number of bytes to follow - 1 except current and acks. ? byte 3: bootloader version 0x11 = version 1.1 ? byte 4: 0x00 - get command ? byte 5: 0x01 - get version ? byte 6: 0x02 - get id ? byte 7: 0x11 - read memory command ? byte 8: 0x21 - go command ? byte 9: 0x31 - write memory command ? byte 10: 0x44 - erase command ? byte 11: 0x63 - write protect command ? byte 12: 0x73 - write unprotect command ? byte 13: 0x82 - readout protect command ? byte 14: 0x92 - readout unprotect command ? byte 15: 0x32 - no-stretch write memory command ? byte 16: 0x45 - no-stretch erase command ? byte 17: 0x64 - no-stretch write protect command ? byte 18: 0x74 - no-stretch write unprotect command ? byte 19: 0x83 - no-stretch readout protect command ? byte 20: 0x93 - no-stretch readout unprotect command ? byte 21: ack
docid024055 rev 2 11/51 AN4221 bootloader command set 50 2.2 get version command the get version command is used to get the i2c bootloader version. when the bootloader receives the command, it transmits the inform ation described below (bootloader version) to the host. figure 4. get version: host side 1. gv = get version. the stm32 sends the bytes as follows: ? byte 1: ack ? byte 2: bootloader version (0 < version 255) (for example, 0x10 = version 1.0) ? byte 3: ack 06y9 6hqgfrppdqg iudph [[)( :dlwiru$&. ru1$&.iudph (qgri*9  5hfhlyhgdwdiudph errwordghuyhuvlrq 1$&. $&. 6wduw*9  :dlwiru$&. ru1$&.iudph 1$&. $&.
bootloader command set AN4221 12/51 docid024055 rev 2 figure 5. get version: device side 1. gv = get version 2.3 get id command the get id command is used to get the version of the chip id (identification). when the bootloader receives the command, it transmits the product id to the host. the stm32 device sends the bytes as follows: ? byte 1: ack ? byte 2: n = the number of bytes - 1 (for stm32, n = 1), except for current byte and acks. ? bytes 3-4: pid (product id) ? byte 3 = msb ? byte 4 = lsb ? byte 5: ack 06y9 5hfhlyhgiudph  [[)(" (qgri*9  6hqg$&.iudph 6hqggdwdiudph errwordghuyhuvlrq 1r <hv 6wduw*9  6hqg1$&.iudph 6hqg$&.iudph
docid024055 rev 2 13/51 AN4221 bootloader command set 50 figure 6. get id command: host side 1. gid = get id. figure 7. get id command: device side 1. gid = get id. 06y9 6hqgfrppdqg iudph [[)' :dlwiru$&. ru1$&.iudph (qgri*,'  5hfhlyhgdwdiudph qxpehurie\whv surgxfw,' 1$&. $&. 6wduw*,'  :dlwiru$&. ru1$&.iudph 1$&. $&. 06y9 5hfhlyhgiudph  [[)'" (qgri*,'  6hqg$&.iudph 6hqggdwdiudph qxpehurie\whv surgxfw,' 1r <hv 6wduw*,'  6hqg1$&.iudph 6hqg$&.iudph
bootloader command set AN4221 14/51 docid024055 rev 2 2.4 read memory command the read memory command is used to read data from any valid memory address. when the bootloader receives the read memory command, it transmits the ack byte to the application. the bootloader then waits for a 4- byte address (byte 1 is the address msb, and byte 4 is the lsb) and a checksum byte, then it checks the received address. if the address is valid and the checksum is correct, the boo tloader transmits an ack byte; otherwise, it transmits a nack byte and aborts the command. if the address is valid and the checksum is correct, the bootloader waits for the number of bytes to be transmitted (n by tes), and for its complemented byte (checksum). if the checksum is correct, the bootloader transmits the needed data to the application, starting from the received address. if the checksum is not correct, it sends a nack before aborting the command. the host sends bytes to the stm32 as follows: 1. bytes 1-2: 0x11+0xee 2. wait for ack 3. bytes 3-6: start address (byte 3: msb, byte 6: lsb) 4. byte 7: checksum: xor (byte 3, byte 4, byte 5 and byte 6) 5. wait for ack 6. byte 8: the number of bytes to be read - 1 (0 < n 255) 7. byte 9: checksum: xor byte 8 (complement of byte 8)
docid024055 rev 2 15/51 AN4221 bootloader command set 50 figure 8. read memory command: host side 1. rm = read memory. 06y9 6hqgfrppdqg iudph [[(( :dlwiru$&. ru1$&.iudph (qgri50 6hqggdwdiudphvwduwdgguhvv  e\whv zlwkfkhfnvxp 5hfhlyhgdwdiudph qhhghggdwdiurpwkh%/ 6hqggdwdiudphqxpehurie\whvwreh uhdg e\wh dqgdfkhfnvxp e\wh 1$&. $&. 6wduw50  :dlwiru$&. ru1$&.iudph 1$&. $&. :dlwiru$&. ru1$&.iudph 1$&. $&.
bootloader command set AN4221 16/51 docid024055 rev 2 figure 9. read memory command: device side 1. rm = read memory. 06y9 6hqg$&.iudph (qgri50  5hfhlyhgdwdiudphvwduwdgguhvv e\whv zlwkfkhfnvxp 6wduw50  &khfnvxp2." 1r <hv $gguhvvydolg  fkhfnvxp2." 1r 5hfhlyhgiudph  [[(( 523dfwlyh 1r <hv <hv 1r <hv 6hqg$&.iudph 5hfhlyhgdwdiudphqxpehurie\whvwreh uhdg e\wh dqgdfkhfnvxp e\wh 6hqg$&.iudph 6hqggdwdiudph uhtxhvwhggdwdwrwkhkrvw 6hqg1$&.iudph
docid024055 rev 2 17/51 AN4221 bootloader command set 50 2.5 go command the go command is used to execute the downloaded code or any other code, by branching to an address specified by the application. when the bootloader receives the go command, it transmits the ack byte to the application. the bootloader then waits for a 4-byte address (byte 1 is the address msb, and byte 4 is lsb) and a checksum byte, then checks the received address. if the address is valid and the checksum is correct, the bootloader transmits an ack byte; otherwise, it transmits a nack byte and aborts the command. when the address is valid and the checksum is correct, the bootloader firmware performs the following: 1. initializes the registers of the peripherals used by the bootloader to their default reset values 2. initializes the user application's main stack pointer 3. jumps to the memory location programmed in the received 'address + 4' (which corresponds to the address of the application's reset handler). for example, if the received address is 0x08000000, the bootloader jumps to the memory location programmed at address 0x08000004. in general, the host should send the base address where the application to jump to is programmed. note: jumping to the application only works if the us er application correctly sets the vector table to point to the application address. the host sends bytes to the stm32 as follows: 1. byte 1: 0x21 2. byte 2: 0xde 3. wait for ack 4. byte 3 to byte 6: start address ? byte 3: msb ? byte 6: lsb 5. byte 7: checksum: xor (byte 3, byte 4, byte 5 and byte 6) 6. wait for ack
bootloader command set AN4221 18/51 docid024055 rev 2 figure 10. go command: host side 06y9 6hqgfrppdqg iudph [['( :dlwiru$&. ru1$&.iudph (qgri*2 6hqggdwdiudph6wduw$gguhvv e\whv dqgfkhfnvxp 1$&. $&. 6wduw*2 :dlwiru$&. ru1$&.iudph 1$&. $&.
docid024055 rev 2 19/51 AN4221 bootloader command set 50 figure 11. go command: device side 06y9 5hfhlyhgiudph  [['(" -xpswrxvhudssolfdwlrq 6hqg$&.iudph 5hfhlyhgdwdiudphvwduwdgguhvv e\whv dqgfkhfnvxp 1r <hv 6wduw*2 6hqg$&.iudph 6hqg1$&.iudph 523dfwlyh <hv 1r $gguhvvydolg  fkhfnvxp2." 1r (qgri*2 <hv
bootloader command set AN4221 20/51 docid024055 rev 2 2.6 write memory command the write memory command is used to write data to any valid memory address (see note: below) of ram, flash memory, or the option byte area. when the bootloader receives the write memory command, it transmits the ack byte to the application. the bootloader then waits for a 4- byte address (byte 1 is the address msb, and byte 4 is the lsb) and a checksum byte, and then checks th e received address. if the received address is valid and the checksum is correct, the bootloader transmits an ack byte; otherwise, it transmits a nack by te and aborts the command. when the address is valid and the checksum is correct, the bootloader: 1. gets a byte, n, which contains the number of data bytes to be received 2. receives the user data ((n + 1) bytes) and the checksum (xor of n and of all data bytes) 3. programs the user data to memory, starting from the received address at the end of the command, if the write oper ation was successful, the bootloader transmits the ack byte; otherwise, it transmits a nack byte to the application and aborts the command. if the write memory command is issued to the option byte area, all options are erased before writing the new values. at the end of the command, the bootloader generates a system reset to take the new configurat ion of the option byte into account. the maximum length of the block to be written to the option bytes depends on the stm32 product, and the address received from the host must be the start address of the option byte area. for more information about option bytes, please refer to the stm32 product reference manual. note: the maximum length of th e block to be written to ram or flash memory is 256 bytes. when writing to the ram, take care not to overlap the first ram memory used by the bootloader firmware. no error is returned when performing write operations to write-protected sectors. the host sends the bytes to the stm32 as follows: 1. byte 1: 0x31 2. byte 2: 0xce 3. wait for ack 4. byte 3 to byte 6: start address ? byte 3: msb ? byte 6: lsb 5. byte 7: checksum: xor (byte3, byte4, byte5, byte6) 6. wait for ack 7. byte 8: number of bytes to be received (0 < n 255) 8. n +1 data bytes: (max 256 bytes) 9. checksum byte: xor (n, n+1 data bytes) 10. wait for ack
docid024055 rev 2 21/51 AN4221 bootloader command set 50 figure 12. write memory command: host side 1. wm = write memory. 06y9 6hqgfrppdqgiudph [[&( :dlwiru$&. ru1$&.iudph (qgri:0 6hqggdwdiudph qxpehurie\whvwrehzulwhq gdwdwrehzulwwhq fkhfnvxp 1$&. $&. 6wduw:0  :dlwiru$&. ru1$&.iudph 1$&. :dlwiru$&. ru1$&.iudph 1$&. $&. 6hqggdwdiudphvwduwdgguhvv e\whv zlwkfkhfnvxp $&.
bootloader command set AN4221 22/51 docid024055 rev 2 figure 13. write memory command: device side 1. wm = write memory. 6hqg$&.iudph (qgri:0  5hfhlyhgdwdiudphvwduwdgguhvv e\whv zlwkfkhfnvxp 6wduw:0  &khfnvxp2." 1r <hv $gguhvvydolg  fkhfnvxp2." 1r 5hfhlyhgiudph [[&(" 523dfwlyh 1r <hv <hv 1r <hv 6hqg$&.iudph 5hfhlyhgdwdiudph qxpehurie\whvwrehzulwwhq gdwdwrehzulwwhq fkhfnvxp 6hqg1$&.iudph :ulwhwkhuhfhlyhggdwdwr phpru\iurpwkhvwduw dgguhvv 6hqg$&.iudph *hqhudwhv\vwhpuhvhw 'dwdzulwwhqlq 2swlrqe\whv" 1r <hv 06y9
docid024055 rev 2 23/51 AN4221 bootloader command set 50 2.7 erase memory command the erase memory command allows the host to erase flash memory pages or sectors using a two-byte addressing mode. when the bootloader receives the erase memory command, it transmits the ack byte to the host. the bootloader then receives two bytes (number of pages or sectors to be erased), t he flash memory page or sector codes (each of which is coded on two bytes, msb first) and a checksum byte (xor of th e sent bytes). if the checksum is correct, the bootloader erases the memory and sends an ack byte to the host; otherwise, it sends a nack byte to the host and the command is aborted. erase memory command specifications the bootloader receives one half-word (two byte s) that contains n, the number of pages or sectors to be erased. for n = 0xfffy (where y is from 0 to f), a special erase is performed (0xffff for global mass erase, 0xfffe an d 0xfffd respectively for bank1 and bank2 mass erase). note: some products do not support the mass erase feature, in which case you can send the erase command with the numbers of all pages or sectors instead. note: codes from 0xfffc to 0xfff0 are reserved. for other values where 0 n < maximum number of pages or sectors, n + 1 pages or sectors are erased. the bootloader receives: ? in the case of a special erase, one by te: the checksum of the previous bytes ? 0x00 for 0xffff, the global erase if n+1 pages or sectors are erased, the bootloader receives (2 x (n + 1)) bytes, each half- word of which contains a page or sector num ber that is coded on two bytes, with the msb first. then all previous byte checksums are received in one byte. note: no error is returned when performing erase operations on write-protected sectors. the maximum number of pages or sectors is re lative to the product, and thus should be respected. the host sends bytes to the stm32 as follows: 1. byte 1: 0x44 2. byte 2: 0xbb 3. wait for ack 4. bytes 3-4: ? special erase (0xfffx), or ? number of pages or sectors to be erased (n+1 where: 0 n < maximum number of pages or sectors) 5. wait for ack (if special erase is not requested) 6. remaining bytes: ? checksum of bytes 3-4 in case of special erase (0x00), or ? (2 x (n + 1)) bytes (page numbers or sectors coded on two bytes msb first) and then the checksum for bytes 3-4 and all the following bytes). 7. wait for ack
bootloader command set AN4221 24/51 docid024055 rev 2 figure 14. erase memory command: host side 1. er = erase memory. note: some products do not support the special erase feature. for these products, this command will be nacked. 06y9 6hqgfrppdqgiudph [[%& :dlwiru$&. ru1$&.iudph (qgri(5  1$&. $&. 6wduw(5  :dlwiru$&. ru1$&.iudph $&. 6shfldo (udvh" 6hqggdwdiudph[)))[ iru6shfldohudvh [)))wr[)))&duh uhvhuyhg fkhfnvxpri wkhwzre\whv 6hqggdwdiudphqxpehuri sdjhvwrehhudvhg1 rqwzr e\whv 06%iluvwfkhfnvxp riwkhwzre\whv 6hqggdwdiudphsdjh qxpehuv hdfkrqwzre\whv 06%iluvw fkhfnvxp :dlwiru$&. ru1$&.iudph $&. 1$&. 1$&.
docid024055 rev 2 25/51 AN4221 bootloader command set 50 figure 15. erase memory command: device side 1. er = erase memory. 2. requested special erase command is nacked if th is command is not supported by stm32 product. 06y9 6hqg$&.iudph (qgri(5  5hfhlyh1xpehuri3djhvwreh hudvhg1 e\whv 06%iluvw fkhfnvxp 6wduw(5  &khfnvxp2." 1r 6shfldo(udvh &pguhfhlyhg" 5hfhlyhgiudph [[%&" 523dfwlyh 1r <hv <hv 1r <hv 5hfhlyhgdwdiudphsdjhfrghv rqe\whvhdfk06%iluvw  fkhfnvxp 6hqg$&.iudph 6hqg 1$&.iudph (udvhwkhfruuhvsrqglqjsdjhv <hv &khfnvxp2." 1r <hv 6hqg 1$&.iudph 3huirup6shfldohudvh [)))[ uhfhlyhg"  1r <hv &khfnvxp2." 1r <hv 1r
bootloader command set AN4221 26/51 docid024055 rev 2 2.8 write protect command the write protect command is used to enable the write protection for some or all flash memory sectors. when the bootloader receives the write protect command, it transmits the ack byte to the host. the bootloader then waits for the number of bytes to be received (sectors to be protected), and then receiv es the flash memory sector codes from the application. at the end of the write protect command, the bootloader transmits the ack byte and generates a system reset to take the new configuration of the option byte into account. the write protect command sequence is as follows: ? the bootloader receives one byte that contai ns n, the number of sectors to be write- protected - 1 (0 n 255). ? the bootloader receives (n + 1) bytes, each byte of which contains a sector code. note: neither the total number of sectors, nor the sector number to be protected are checked. this means that no error is returned when a comma nd is passed with either a wrong number of sectors to be protected, or a wrong sector number. if a second write protect command is executed , the flash memory sectors that had been protected by the first command become unprotected, and only the sectors passed within the second write protect command become protected.
docid024055 rev 2 27/51 AN4221 bootloader command set 50 figure 16. write protect command: host side 1. wp = write protect. $&. 06y9 6hqgfrppdqg iudph [[& :dlwiru$&. ru1$&.iudph (qgri:3  6hqggdwdiudphqxpehurivhfwruv wrehsurwhfwhg e\wh fkhfnvxp 6hqggdwdiudphvhfwru frghvfkhfnvxp 1$&. $&. 6wduw:3  :dlwiru$&. ru1$&.iudph 1$&. :dlwiru$&. ru1$&.iudph 1$&.
bootloader command set AN4221 28/51 docid024055 rev 2 figure 17. write protect command: device side 1. wp = write protect. <hv 06y9 6hqg$&.iudph (qgri:3  5hfhlyhgdwdiudphqxpehu rivhfwruvwrehsurwhfwhg e\wh  fkhfnvxp 6wduw:3  &khfnvxp2." 1r <hv 5hfhlyhgiudph [[&" 523dfwlyh 1r <hv 1r 5hfhlyhgdwdiudph vhfwrufrghvfkhfnvxp 6hqg$&.iudph *hqhudwhv\vwhpuhvhw 6hqg1$&.iudph :ulwhsurwhfwwkhuhtxhvwhg vhfwruv &khfnvxp2." 1r 6hqg$&.iudph <hv
docid024055 rev 2 29/51 AN4221 bootloader command set 50 2.9 write unprotect command the write unprotect command is used to disa ble the write protection of all flash memory sectors. when the bootloader receives the wr ite unprotect command, it transmits the ack byte to the host. the bootloader then disabl es the write protection of all flash memory sectors, and transmits the ack byte. a system reset is generated to take the new co nfiguration of the option byte into account. figure 18. write unprotect command: host side 1. wpun = write unprotect. 06y9 6hqgfrppdqg iudph [[&  :dlwiru$&. ru1$&.iudph (qgri:381  1$&. $&. 6wduw:381  :dlwiru$&. ru1$&.iudph 1$&. $&.
bootloader command set AN4221 30/51 docid024055 rev 2 figure 19. write unprotect command: device side 1. wpun = write unprotect. 2.10 readout protect command the readout protect command is used to enab le the flash memory read protection. when the bootloader receives the readout protect command, it transmits the ack byte to the host, and enables the read protection for the flash memory. at the end of the readout protect command, the bootloader transmits the ack byte and generates a system reset to take the new configuration of the option byte into account. 06y9 6hqg$&.iudph (qgri:381  5hpryhwkhsurwhfwlrqiruwkh hqwluh)odvkphpru\ 6wduw:381  5hfhlyhgiudph [[&" 523dfwlyh 1r <hv <hv 1r 6hqg$&.iudph *hqhudwhv\vwhpuhvhw 6hqg1$&.iudph
docid024055 rev 2 31/51 AN4221 bootloader command set 50 figure 20. readout protect command: host side 1. rdp_prm = readout protect. figure 21. readout protect command: device side 1. rdp_prm = readout protect. 06y9 6hqgfrppdqg iudph [[' :dlwiru$&. ru1$&.iudph (qgri5'3b350  1$&. $&. 6wduw5'3b 350  :dlwiru$&. ru1$&.iudph 1$&. $&. 06y9 6hqg$&.iudph (qgri5'3b350  $fwlydwh5hdgsurwhfwlrqiru)odvk phpru\ 6wduw5'3b350  5hfhlyhgiudph [['" 523dfwlyh 1r <hv <hv 1r 6hqg$&.iudph *hqhudwhv\vwhpuhvhw 6hqg1$&.iudph
bootloader command set AN4221 32/51 docid024055 rev 2 2.11 readout unprotect command the readout unprotect command is used to disable flash memory read protection. when the bootloader receives the readout unprotect command, it transmits the ack byte to the host. the bootloader then disables the read protection for the entire flash memory, which results in an erasure of the entire flash memory. if th e operation is unsuccessful, the bootloader transmits a nack, and the read protection remains active. note: this operation takes the same time to erase all flash pages or sectors (or to perform a mass erase if it is supported by the product), so the host should wait until the end of this operation. for the flash erase timings, please refer to the product datasheet. at the end of the readout unprotect command, the bootloader transmits an ack and generates a system reset to take the new configuration of the option byte into account. figure 22. readout unprotect command: host side 1. rdu_prm = readout unprotect. 06y9 6hqgfrppdqg iudph [[' :dlwiru$&. ru1$&.iudph (qgri5'8b350  1$&. $&. 6wduw5'8b350  :dlwiru$&. ru1$&.iudph 1$&. $&.
docid024055 rev 2 33/51 AN4221 bootloader command set 50 figure 23. readout unprotect command: device side 1. rdu_prm = readout unprotect. 06y9 6hqg$&.iudph (qgri5'8b350  'lvdeoh523 6wduw5'8b350  5hfhlyhgiudph [['" 1r 6hqg$&.iudph *hqhudwhv\vwhpuhvhw 6hqg1$&.iudph &ohdudoo5$0phpru\
bootloader command set AN4221 34/51 docid024055 rev 2 2.12 no-stretch writ e memory command the no-stretch write memory command is used to write data to any valid memory area. when the bootloader receives the no-stretch write memory command, it transmits the ack byte to the application. the bootloader then waits for a 4-byte address (byte 1 is the address msb, and byte 4 is the lsb) and a checksu m byte, and then checks the received address. if the received address is valid and the checksum is correct, the bootloader transmits an ack byte; otherwise, it transmits a nack by te and aborts the command. when the address is valid and the checksum is correct, the bootloader: 1. gets a byte, n, which contains the number of data bytes to be received 2. receives the user data ((n + 1) bytes) and the checksum (xor of n and of all data bytes) 3. programs the user data to memory, starting from the received address 4. returns a busy state (0x76) while operation is ongoing at the end of the command, if the write oper ation was successful, the bootloader transmits the ack byte; otherwise, it transmits a nack byte to the application and aborts the command. note: if the no-stretch write memory command is i ssued to the option byte area, the bootloader generates a system reset to take the new configuration of the option byte into account. the maximum length of the block to be written to memory is 256 bytes except for the option bytes the maximum length depends on the stm32 product, and the address received from the host must be the start address of the opti on byte area. for more information, please refer to the stm32 product reference manual. no error is returned when performing write operations to write-protected sectors. the host sends the bytes to the stm32 as follows: 1. byte 1: 0x32 2. byte 2: 0xcd 3. wait for ack 4. byte 3 to byte 6: start address ? byte 3: msb ? byte 6: lsb 5. byte 7: checksum: xor (byte3, byte4, byte5, byte6) 6. wait for ack 7. byte 8: number of bytes to be received (0 < n 255) 8. n +1 data bytes: (max 256 bytes) 9. checksum byte: xor (n, n+1 data bytes) 10. wait for ack (if busy keep polling on ack/nack)
docid024055 rev 2 35/51 AN4221 bootloader command set 50 figure 24. no-stretch write memory command: host side 1. wm = write memory. 6hqgfrppdqgiudph [[&' :dlwiru$&. ru1$&.iudph (qgri1r6wuhwfk:0  6hqggdwdiudph qxpehurie\whvwrehzulwhq gdwdwrehzulwwhq fkhfnvxp 1$&. $&. 6wduw1r6wuhwfk:0  5hfhlyhg uhvsrqvh 1$&. :dlwiru$&. ru1$&.iudph 1$&. $&. 6hqggdwdiudphvwduwdgguhvv e\whv zlwkfkhfnvxp $&. 5hvsrqvh)udph %86< 069
bootloader command set AN4221 36/51 docid024055 rev 2 figure 25. no-stretch write memory command: device side 1. wm = write memory. 6hqg$&.iudph (qgri1r6wuhwfk:0  5hfhlyhgdwdiudphvwduwdgguhvv e\whv zlwkfkhfnvxp 6wduw1r6wuhwfk:0  &khfnvxp2." 1r $gguhvvydolg  fkhfnvxp2." 1r 5hfhlyhgiudph [[&'" 523dfwlyh 1r <hv <hv 1r <hv 6hqg$&.iudph 5hfhlyhgdwdiudph qxpehurie\whvwrehzulwwhq gdwdwrehzulwwhq fkhfnvxp 6hqg 1$&. iudph :ulwhwkhuhfhlyhggdwdwr )odvkphpru\iurpwkhvwduw dgguhvv <hv <hv 6hqg$&.iudph *hqhudwhv\vwhpuhvhw 2shudwlrq frpsohwh 6hqg%xv\ iudph [ 1r 069
docid024055 rev 2 37/51 AN4221 bootloader command set 50 2.13 no-stretch erase memory command the no-stretch erase memory command allows the host to erase flash memory pages or sectors using a two-byte addressing mode . when the bootloader receives the erase memory command, it transmits the ack byte to the host. the bootloader then receives two bytes (number of pages or sectors to be erased), the flash memory page or sector codes (each of which is coded on tw o bytes, msb first) and a checksum byte (xor of the sent bytes). if the checksum is correct, the bootlo ader erases the memory (returns busy state (0x76) while operation is ongoing) then sends an ack byte to the host; otherwise, it sends a nack byte to the host and the command is aborted. no-stretch erase memory command specifications the bootloader receives one half-word (two byte s) that contains n, the number of pages or sectors to be erased. for n = 0xfffy (where y is from 0 to f), a special erase is performed (0xffff for global mass erase, 0xfffe an d 0xfffd respectively for bank1 and bank2 mass erase). note: some products do not support the mass erase feature, in which case you can send the erase command with the numbers of all pages or sectors instead. note: codes from 0xfffc to 0xfff0 are reserved. for other values where 0 n < maximum number of pages or sectors, n + 1 pages or sectors are erased. the bootloader receives: ? in the case of a special erase, one by te: the checksum of the previous bytes ? 0x00 for 0xffff, the global erase if n+1 pages or sectors are erased, the bootloader receives (2 x (n + 1)) bytes, each half- word of which contains a page or sector num ber that is coded on two bytes, with the msb first. then all previous byte checksums are received in one byte. note: no error is returned when performing erase operations on write-protected sectors. the maximum number of pages or sectors is re lative to the product, and thus should be respected. the host sends bytes to the stm32 as follows: 1. byte 1: 0x44 2. byte 2: 0xbb 3. wait for ack 4. bytes 3-4: ? special erase (0xfffx), or ? number of pages or sectors to be erased (n+1 where: 0 n < maximum number of pages or sectors) 5. wait for ack (if special erase is not requested) 6. remaining bytes: ? checksum of bytes 3-4 in case of special erase (0x00), or ? (2 x (n + 1)) bytes (page numbers or sectors coded on two bytes msb first) and then the checksum for bytes 3-4 and all the following bytes). 7. wait for ack (if busy keep polling on ack/nack)
bootloader command set AN4221 38/51 docid024055 rev 2 figure 26. no-stretch erase memory command: host side 1. er = erase memory. note: some products do not support the special erase feature. for these products, this command will be nacked. $&. 1$&. $&. 1$&. 6hqgfrppdqgiudph [[%% :dlwiru$&. ru1$&.iudph 6wduw1r6wuhwfk(5  6shfldo (udvh" 6hqggdwdiudph[)))[ iru6shfldohudvh [)))wr[)))&duh uhvhuyhg fkhfnvxpri wkhwzre\whv 6hqggdwdiudphqxpehuri sdjhvwrehhudvhg1 rqwzr e\whv 06%iluvwfkhfnvxp riwkhwzre\whv 6hqggdwdiudphsdjh qxpehuv hdfkrqwzre\whv 06%iluvw fkhfnvxp :dlwiru$&. ru1$&.iudph (qgri1r6wuhwfk(5  5hfhlyhg uhvsrqvh 1$&. $&. 5hvsrqvh)udph %86< 069
docid024055 rev 2 39/51 AN4221 bootloader command set 50 figure 27. no-stretch erase memory command: device side 1. er = erase memory. 2. requested special erase command is nacked if th is command is not supported by stm32 product. 1r <hv <hv <hv 1r 1r <hv 6hqg$&.iudph (qgri1r6wuhwfk(5  5hfhlyh1xpehuri3djhvwrehhudvhg 1 e\whv 06%iluvwfkhfnvxp 6wduw1r6wuhwfk(5  &khfnvxp2." 6shfldo(udvh &pguhfhlyhg" 5hfhlyhgiudph [[%%" 523dfwlyh 1r <hv <hv 5hfhlyhgdwdiudphsdjhfrghv rq e\whvhdfk06%iluvw fkhfnvxp 6hqg 1$&.iudph (udvhwkhfruuhvsrqglqjsdjhv &khfnvxp2." 1r <hv 6hqg 1$&.iudph 3huirup6shfldohudvh [)))[ uhfhlyhg"  1r &khfnvxp2." 1r 6hqg$&.iudph 2shudwlrq frpsohwh 6hqg%xv\ iudph [ <hv 1r 069
bootloader command set AN4221 40/51 docid024055 rev 2 2.14 no-stretch write protect command the no-stretch write protect command is used to enable the write protection for some or all flash memory sectors. when the bootloader receives the write protect command, it transmits the ack byte to the host. the bootloader then waits for the number of bytes to be received (sectors to be protected), then rece ives the flash memory sector codes from the application and returns busy state (0x76) while operation is ongoing. at the end of the no-stretch write protect co mmand, the bootloader transmits the ack byte and generates a system reset to take the new configuration of the option byte into account. the write protect command sequence is as follows: ? the bootloader receives one byte that contai ns n, the number of sectors to be write- protected - 1 (0 n 255). ? the bootloader receives (n + 1) bytes, each byte of which contains a sector code. note: neither the total number of sectors, nor the sector number to be protected are checked. this means that no error is returned when a comma nd is passed with either a wrong number of sectors to be protected, or a wrong sector number. if a second write protect command is executed , the flash memory sectors that had been protected by the first command become unprotected, and only the sectors passed within the second write protect command become protected.
docid024055 rev 2 41/51 AN4221 bootloader command set 50 figure 28. no-stretch write protect command: host side 1. wp = write protect. 6hqgfrppdqg iudph [[% :dlwiru$&. ru1$&.iudph (qgri1r6wuhwfk:3  6hqggdwdiudphqxpehurivhfwruv wrehsurwhfwhg e\wh fkhfnvxp 6hqggdwdiudphvhfwru frghvfkhfnvxp 1$&. $&. 6wduw1r6wuhwfk:3  :dlwiru$&. ru1$&.iudph 1$&. 5hfhlyhg uhvsrqvh 1$&. $&. 5hvsrqvh)udph %86< 069
bootloader command set AN4221 42/51 docid024055 rev 2 figure 29. no-stretch write protect command: device side 1. wp = write protect. 6hqg$&.iudph 2shudwlrq frpsohwh 6hqg%xv\ iudph [ <hv 6hqg$&.iudph (qgri1r6wuhwfk:3  5hfhlyhgdwdiudphqxpehu rivhfwruvwrehsurwhfwhg e\wh  fkhfnvxp 6wduw1r6wuhwfk:3  &khfnvxp2." 1r <hv 5hfhlyhgiudph [[%" 523dfwlyh 1r <hv 1r 5hfhlyhgdwdiudph vhfwrufrghvfkhfnvxp *hqhudwhv\vwhpuhvhw 6hqg1$&.iudph (qdeoh:ulwhsurwhfwlrqri vhohfwhgvhfwruv &khfnvxp2." 1r 6hqg$&.iudph <hv 1r <hv 069
docid024055 rev 2 43/51 AN4221 bootloader command set 50 2.15 no-stretch writ e unprotect command the no-stretch write unprotect command is used to disable the write protection of all flash memory sectors. when the bootloader receives the write unprotect command, it transmits the ack byte to the host. the bootloader then disables the write protection of all flash memory sectors, returns busy state (0x76) while operation is ongoing.at the end it transmits the ack byte. a system reset is generated to take the new co nfiguration of the option byte into account. figure 30. no-stretch write unprotect command: host side 1. wpun = write unprotect. 6hqgfrppdqg iudph [[% :dlwiru$&. ru1$&.iudph (qgri1r6wuhwfk:381  1$&. 6wduw1r6wuhwfk:381  5hfhlyhg uhvsrqvh 1$&. $&. 5hvsrqvh)udph %86< 069
bootloader command set AN4221 44/51 docid024055 rev 2 figure 31. no-stretch write unprotect command: device side 1. wpun = write unprotect. 2.16 no-stretch readout protect command the no-stretch readout protect command is used to enable the flash memory read protection. when the bootloader receives t he readout protect command, it transmits the ack byte to the host, enables the read protection for the flash memory and returns busy state (0x76) while operation is ongoing. at the end of the no-stretch readout protect command, the bootloader transmits the ack byte and generates a system reset to take th e new configuration of the option byte into account. 6hqg$&.iudph 2shudwlrq frpsohwh 6hqg%xv\ iudph [ <hv 6hqg$&.iudph (qgri1r6wuhwfk:381  6wduw1r6wuhwfk:381  5hfhlyhgiudph [[%" 523dfwlyh 1r <hv 1r *hqhudwhv\vwhpuhvhw 6hqg1$&.iudph 'lvdeoh:ulwhsurwhfwlrqridoo vhfwruv 1r <hv 069
docid024055 rev 2 45/51 AN4221 bootloader command set 50 figure 32. nostretch readout protect command: host side 1. rdp_prm = readout protect. 6hqgfrppdqg iudph [[& :dlwiru$&. ru1$&.iudph (qgri1r6wuhwfk5'3b350  1$&. 6wduw1r6wuhwfk5'3b350  5hfhlyhg uhvsrqvh 1$&. $&. 5hvsrqvh)udph %86< 069
bootloader command set AN4221 46/51 docid024055 rev 2 figure 33. no-stretch readout protect command: device side 1. rdp_prm = readout protect. 2.17 no-stretch readou t unprotect command the no-stretch readout unprotect command is used to disable flash memory read protection. when the bootloader receives the readout unprotect command, it transmits the ack byte to the host. the bootloader then disables the read protection for the entire flash memory, which results in an erasure of the entire flash memory and returns busy state (0x7 6) while operation is ongoing. if the operation is unsuccessful, the bootloader transmits a nack, and the read protection remains active. at the end of the no-stretch readout unprot ect command, the bootloader transmits an ack and generates a system reset to take the new configuration of the option byte into account. 6hqg$&.iudph 2shudwlrq frpsohwh 6hqg%xv\ iudph [ <hv 6hqg$&.iudph (qgri1r6wuhwfk5'3b350  6wduw1r6wuhwfk5'3b350  5hfhlyhgiudph [[&" 523dfwlyh 1r <hv 1r *hqhudwhv\vwhpuhvhw 6hqg1$&.iudph $fwlydwh5hdgsurwhfwlrqirudoo vhfwruv 1r <hv 069
docid024055 rev 2 47/51 AN4221 bootloader command set 50 figure 34. no-stretch readout unprotect command: host side 1. rdu_prm = readout unprotect. 6hqgfrppdqg iudph [[& :dlwiru$&. ru1$&.iudph (qgri1r6wuhwfk5'8b350  1$&. 6wduw1r6wuhwfk5'8b350  5hfhlyhg uhvsrqvh 1$&. $&. 5hvsrqvh)udph %86< 069
bootloader command set AN4221 48/51 docid024055 rev 2 figure 35. no-stretch readout unprotect command: device side 1. rdu_prm = readout unprotect. 6hqg$&.iudph 2shudwlrq frpsohwh 6hqg%xv\ iudph [ <hv 6hqg$&.iudph (qgri1r6wuhwfk5'8b350  6wduw1r6wuhwfk5'8b350  5hfhlyhgiudph  [[&" 1r *hqhudwhv\vwhpuhvhw 6hqg1$&.iudph 'lvdeoh523 1r <hv &ohdu$oo5$0 069
docid024055 rev 2 49/51 AN4221 bootloader protocol version evolution 50 3 bootloader protocol version evolution table 3 lists the bootloader versions. table 3. bootloader protocol versions version description v1.0 initial protocol version. v1.1 this version implements new i2c co mmands: no-stretch write memory, no-stretch erase memory, no-stretch write prtotect, no-stretch write unprotect, no-stretch readout protect and no-stretch readout unprotect.
revision history AN4221 50/51 docid024055 rev 2 4 revision history table 4. document revision history date revision changes 18-jan-2013 1 initial release. 02-may-2014 2 updated list of applicable products in table 1 . updated set of commands in table 2 . updated section 2: bootloader command set . added section 2.12 , section 2.13 , section 2.14 , section 2.15 , section 2.16 and section 2.17 . added new protocol version in table 3 .
docid024055 rev 2 51/51 AN4221 51 please read carefully: information in this document is provided solely in connection with st products. stmicroelectronics nv and its subsidiaries (?st ?) reserve the right to make changes, corrections, modifications or improvements, to this document, and the products and services described he rein at any time, without notice. all st products are sold pursuant to st?s terms and conditions of sale. purchasers are solely responsible for the choice, selection and use of the st products and services described herein, and st as sumes no liability whatsoever relating to the choice, selection or use of the st products and services described herein. no license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. i f any part of this document refers to any third party products or services it shall not be deemed a license grant by st for the use of such third party products or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoev er of such third party products or services or any intellectual property contained therein. unless otherwise set forth in st?s terms and conditions of sale st disclaims any express or implied warranty with respect to the use and/or sale of st products including without limitation implied warranties of merchantability, fitness for a parti cular purpose (and their equivalents under the laws of any jurisdiction), or infringement of any patent, copyright or other intellectual property right. st products are not designed or authorized for use in: (a) safety critical applications such as life supporting, active implanted devices or systems wi th product functional safety requirements; (b) aeronautic applications; (c) automotive applications or environments, and/or (d) aerospace applications or environments. where st products are not designed for such use, the purchaser shall use products at purchaser?s sole risk, even if st has been informed in writing of such usage, unless a product is expressly designated by st as being intended for ?automotive, automotive safety or medical? industry domains according to st product design specifications. products formally escc, qml or jan qualified are deemed suitable for use in aerospace by the corresponding governmental agency. resale of st products with provisions different from the statements and/or technical features set forth in this document shall immediately void any warranty granted by st for the st product or service described herein and shall not create or extend in any manner whatsoev er, any liability of st. st and the st logo are trademarks or registered trademarks of st in various countries. information in this document supersedes and replaces all information previously supplied. the st logo is a registered trademark of stmicroelectronics. all other names are the property of their respective owners. ? 2014 stmicroelectronics - all rights reserved stmicroelectronics group of companies australia - belgium - brazil - canada - china - czech republic - finland - france - germany - hong kong - india - israel - ital y - japan - malaysia - malta - morocco - philippines - singapore - spain - sweden - switzerland - united kingdom - united states of america www.st.com


▲Up To Search▲   

 
Price & Availability of AN4221

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X